package metalink.staff;

import java.io.File;
import com.opensymphony.xwork2.ActionSupport;
import java.util.*;
import java.sql.*;

import vo.DocumentListVo;

import model.staff.*;
import myutil.*;

public class upload extends ActionSupport{
	String subject="";
	String comment="";
	File attached_file;
	String file_name;
	ArrayList<DocumentListVo> list = new ArrayList<DocumentListVo>();
	ArrayList<DocumentListVo> doclist = new ArrayList<DocumentListVo>();
	String id="";
	
	

	public String getId() {
		return id;
	}


	public void setId(String id) {
		this.id = id;
	}


	public ArrayList<DocumentListVo> getList() {
		return list;
	}


	public void setList(ArrayList<DocumentListVo> list) {
		this.list = list;
	}


	public ArrayList<DocumentListVo> getDoclist() {
		return doclist;
	}


	public void setDoclist(ArrayList<DocumentListVo> doclist) {
		this.doclist = doclist;
	}


	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public String getComment() {
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
	public File getAttached_file() {
		return attached_file;
	}
	public void setAttached_file(File attached_file) {
		this.attached_file = attached_file;
	}
	public String getFile_name() {
		return file_name;
	}
	public void setFile_name(String file_name) {
		this.file_name = file_name;
	}
	
	int course_professor_id;
	
	
	public int getCourse_professor_id() {
		return course_professor_id;
	}
	public void setCourse_professor_id(int course_professor_id) {
		this.course_professor_id = course_professor_id;
	}
	public String execute(){
		new DocumentUpload().update_course_document_table(comment, subject, attached_file, file_name,course_professor_id);
		DocumentMo mo = new DocumentMo();
		if(id.equals("")){	
		}
		else
		{course_professor_id=Integer.parseInt(id);}
		
		try {
			doclist=mo.getDocumentCourseDetails(course_professor_id);
			list=mo.getDocumentList(course_professor_id);
		
		} catch (Exception e) {
			addActionError(e.getMessage());
		}
		return SUCCESS;
	}
}
